package commands

import (
	"github.com/spf13/cobra"
	"golang-manage-admin/cron"
	_ "golang-manage-admin/providers"
	"golang-manage-admin/queue/publish"
)

var TimerCmd = &cobra.Command{
	Use:   "timer",
	Short: "定时任务服务",
	Args:  cobra.NoArgs, //没有参数
	//命令执行
	Run: func(cmd *cobra.Command, args []string) {
		//初始化定时器
		timer := cron.CronTimer{}
		timer.Init()

		// 推送队列初始化
		publish.PublishInit()

		//运行定时器
		timer.Run()
	},
}
